package com.ruoyi.historyVideo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.historyVideo.domain.HistoryVideo;
import com.ruoyi.historyVideo.mapper.HistoryVideoMapper;
import com.ruoyi.historyVideo.service.IHistoryVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 历史视频Service业务层处理
 *
 * @author ruoyi
 * @date 2024-11-26
 */
@Service
public class HistoryVideoServiceImpl extends ServiceImpl<HistoryVideoMapper, HistoryVideo>
        implements IHistoryVideoService {
    @Autowired
    private HistoryVideoMapper historyVideoMapper;

    /**
     * 查询历史视频
     *
     * @param id 历史视频主键
     * @return 历史视频
     */
    @Override
    public HistoryVideo selectHistoryVideoById(Long id) {
        return historyVideoMapper.selectHistoryVideoById(id);
    }

    /**
     * 查询历史视频列表
     *
     * @param historyVideo 历史视频
     * @return 历史视频
     */
    @Override
    public List<HistoryVideo> selectHistoryVideoList(HistoryVideo historyVideo) {
        return historyVideoMapper.selectHistoryVideoList(historyVideo);
    }

    /**
     * 新增历史视频
     *
     * @param historyVideo 历史视频
     * @return 结果
     */
    @Override
    public int insertHistoryVideo(HistoryVideo historyVideo) {
        historyVideo.setCreateTime(DateUtils.getNowDate());
        return historyVideoMapper.insertHistoryVideo(historyVideo);
    }

    /**
     * 修改历史视频
     *
     * @param historyVideo 历史视频
     * @return 结果
     */
    @Override
    public int updateHistoryVideo(HistoryVideo historyVideo) {
        historyVideo.setUpdateTime(DateUtils.getNowDate());
        return historyVideoMapper.updateHistoryVideo(historyVideo);
    }

    /**
     * 批量删除历史视频
     *
     * @param ids 需要删除的历史视频主键
     * @return 结果
     */
    @Override
    public int deleteHistoryVideoByIds(Long[] ids) {
        return historyVideoMapper.deleteHistoryVideoByIds(ids);
    }

    /**
     * 删除历史视频信息
     *
     * @param id 历史视频主键
     * @return 结果
     */
    @Override
    public int deleteHistoryVideoById(Long id) {
        return historyVideoMapper.deleteHistoryVideoById(id);
    }
}
